/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.hera.process.form.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.hera.base.domain.BaseDomain;
import com.hera.process.config.domain.ParameterDetail;
import com.hera.process.external.domain.AdditionalTable;

/**
 *
 * @author cmontes
 */
@Entity
public class Dynaform extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "Dynaform")
    @TableGenerator(name = "Dynaform", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_id", pkColumnValue = "DYNAFORM", allocationSize = 1)
    @Column(name = "ID_DYNAFORM")
    private Long idDynaform;
    private String name;
    private String description;    
    @ManyToOne
    @JoinColumn(name="TYPE_ID")
    private ParameterDetail type;
    //@OneToMany(mappedBy = "dynaform")
    @Transient
    private List<FormField> formFieldList;
    @JoinColumn(name = "ID_ADDITIONAL_TABLE", referencedColumnName = "ID_ADDITIONAL_TABLE")
    @ManyToOne
    private AdditionalTable additionalTable;
    /*@OneToMany(cascade = CascadeType.ALL, mappedBy = "dynaform")
    private List<DynaformStage> dynaformStageList;*/
    
    @Column(name = "ID_PROCESS")
    private Long idProcess;

    public Dynaform() {
    }

    public Dynaform(Long idDynaform) {
        this.idDynaform = idDynaform;
    }

    public Long getIdDynaform() {
        return idDynaform;
    }

    public void setIdDynaform(Long idDynaform) {
        this.idDynaform = idDynaform;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
    
    public ParameterDetail getType() {
		return type;
	}

	public void setType(ParameterDetail type) {
		this.type = type;
	}

	public List<FormField> getFormFieldList() {
        return formFieldList;
    }

    public void setFormFieldList(List<FormField> formFieldList) {
        this.formFieldList = formFieldList;
    }

    public AdditionalTable getAdditionalTable() {
        return additionalTable;
    }

    public void setAdditionalTable(AdditionalTable additionalTable) {
        this.additionalTable = additionalTable;
    }
    
    
/*
    public List<DynaformStage> getDynaformStageList() {
        return dynaformStageList;
    }

    public void setDynaformStageList(List<DynaformStage> dynaformStageList) {
        this.dynaformStageList = dynaformStageList;
    }*/

    public Long getIdProcess() {
		return idProcess;
	}

	public void setIdProcess(Long idProcess) {
		this.idProcess = idProcess;
	}

	@Override
    public int hashCode() {
        int hash = 0;
        hash += (idDynaform != null ? idDynaform.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof Dynaform)) {
            return false;
        }
        Dynaform other = (Dynaform) object;
        if ((this.idDynaform == null && other.idDynaform != null) || (this.idDynaform != null && !this.idDynaform.equals(other.idDynaform))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return name;
    }
    
}
